
<template>
  <div class="common-layout">
    <el-container style="width: 100%; height: 100%">
      <el-header class="elheader" >
        <!--  <p style="font-size: 12px;  color: #fff;padding-left: 10px"> 公司名称</p>    <p style="font-size: 12px;  color: #fff"> 公司名称</p>
        <el-tag type="danger"
          >欢迎:{{ store.ccstore.userName }},角色为:{{
            store.ccstore.roleName
          }}</el-tag -->
           <div class="left-section">
      <p class="company-name">公司名称</p>
      <nav class="nav-menu">
        <div 
          v-for="(item, index) in menuItems" 
          :key="index"
          :class="['menu-item', { 'active': currentTab === item.key }]"
          @click="switchTab(item.key)"
        >
          {{ item.label }}
        </div>
      </nav>
    </div>
        
         <div class="right-section">
      <div class="app-market">
      
        <span>目前市场</span>
      </div>
      <div class="client-type">

        <span>用户端</span>
      </div>
      <div class="user-info">
        <span class="username">{{ store.ccstore.userName }}</span>
        
      </div>
    </div>
        <span class="logout">
          <RouterLink to="/">退出登录</RouterLink>
        </span>
      </el-header>
      <el-container>
        <el-col :span="5" >
      
      <el-menu
        default-active="2"
        class="el-menu-vertical-demo"
        router
      >
      

           <el-sub-menu index="1">
          <template #title>
            <el-icon><location /></el-icon>
            <span>溯源管理</span>
          </template>
            <el-menu-item index="/GetProductsShoopView">生产信息列表</el-menu-item>
          <!--   <el-menu-item index="/CreateLeaveRequestsView">请假申请</el-menu-item>
            <el-menu-item index="/AppUpdataView">审批页面</el-menu-item> -->
            <!-- <el-menu-item index="/UpdataLeaveRequestsView">修改申请表</el-menu-item> -->
           
        </el-sub-menu>
      
      </el-menu>
    </el-col>


        <el-main>
          <RouterView />
        </el-main>
      </el-container>
    </el-container>
  </div>
  <!-- <RouterView /> -->
</template>
<script setup lang="ts">
import { onMounted, reactive, ref } from "vue";
import { RouterLink, RouterView } from "vue-router";
import HelloWorld from "../components/HelloWorld.vue";
import { useCounterStore } from "@/stores/counter";
import { ElMessage } from "element-plus";
import { useRouter } from "vue-router";
import axios from "axios";

const store = useCounterStore();
const router = useRouter();

// 响应式菜单状态
const currentTab = ref('enterprise');
const menuItems = ref([
  { label: '团队管理', key: 'team' },
  { label: '企业管理', key: 'enterprise' },
  { label: '平台运营', key: 'platform' },
  { label: '系统设置', key: 'system' }
]);

const switchTab = (key) => {
  currentTab.value = key;
  // 这里可以添加路由跳转逻辑
};

</script>
<style scoped>
header {
  line-height: 1.5;
  max-height: 100vh;
}

.logo {
  display: block;
  margin: 0 auto 2rem;
}

nav {
  width: 100%;
  font-size: 12px;
  text-align: center;
  margin-top: 2rem;
}

nav a.router-link-exact-active {
  color: var(--color-text);
}

nav a.router-link-exact-active:hover {
  background-color: transparent;
}

nav a {
  display: inline-block;
  padding: 0 1rem;
  border-left: 1px solid var(--color-border);
}

nav a:first-of-type {
  border: 0;
}

@media (min-width: 1024px) {
  header {
    display: flex;
    place-items: center;
    padding-right: calc(var(--section-gap) / 2);
  }

  .logo {
    margin: 0 2rem 0 0;
  }

  header .wrapper {
    display: flex;
    place-items: flex-start;
    flex-wrap: wrap;
  }

  nav {
    text-align: left;
    margin-left: -1rem;
    font-size: 1rem;

    padding: 1rem 0;
    margin-top: 1rem;
  }
}

.elheader {
  display: flex;
  background-color: black;
}
.logout {
  margin-left: auto;
  margin-right: 20px;
}



/* 容器样式 */
.header-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 64px;
  padding: 0 24px;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* 左侧区域 */
.left-section {
  display: flex;
  align-items: center;
  gap: 40px;
}

.company-name {
  font-size: 20px;
  font-weight: 500;
  color:#f0f6ff;
  padding: 8px 12px;
  width: 200px;
}

.nav-menu {
  display: flex;
  gap: 30px;
}

.menu-item {
  padding: 8px 16px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.3s;
  color: #666;
}

.menu-item:hover {
  background: #f0f6ff;
}

.menu-item.active {
  background: #1677ff;
  color: white;
}



/* 右侧区域 */
.right-section {
  display: flex;
  align-items: center;
  padding-top: 14px ;
  gap: 24px;
  color: #666;
}

.app-market, .client-type, .user-info {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  padding: 6px 12px;
  border-radius: 4px;
  transition: background 0.3s;
}

.app-market:hover, .client-type:hover {
  background: #f5f5f5;
}

/* .icon {
  font-family: 'iconfont'; 需要引入图标字体
  font-size: 16px;
} */

.username {
  font-weight: 500;
}

.arrow {
  font-size: 12px;
  margin-left: 4px;
}
</style>
